package com.xuan.controller;

import com.xuan.bean.Product;
import com.xuan.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {
    @Autowired
   ProductService productService;


    @GetMapping(value = "/productId/{id}")
    public Product getProductById(@PathVariable("id") Long productId) {
        Product product = productService.getProductById(productId);
        return product;
    }
}
